<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>  
    <title>联系我们</title>

	<meta http-equiv="cache-control" content="no-cache">
	
    <link rel="stylesheet" type="text/css" href="<%=basePath %>css/form.css" />
    
    	<link rel="stylesheet" type="text/css" href="<%=basePath %>css/map.css" />
		<link rel="stylesheet" type="text/css"
			href="<%=basePath %>css/jquery-ui-1.8.13.custom.css" />

		<script
			src="http://www.google.com/jsapi?key=ABQIAAAAahcO7noe62FuOIQacCQQ7RTHkUDJMJAZieEeKAqNDtpKxMhoFxQsdtJdv3FJ1dT3WugUNJb7xD-jsQ"
			type="text/javascript"></script>
		<script type="text/javascript">
			google.load("maps", "3", {'other_params':'sensor=true'});
		</script>
		<script type="text/javascript" src="<%=basePath %>js/jquery-1.7.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/jquery-ui-1.8.13.custom.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/jquery.ui.map.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/jquery.ui.gmap.microformat.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/Map.js"></script>
  </head>
  
  <body>

<form:form commandName="companyTouch" method="post" id="myForm"
                                   enctype="multipart/form-data" >

<table width="530">
   <tr>
    <td width="400" height="35">
       <label for="webSite">企业名称 ： </label>
        <form:input path="name" size="30" />
        <form:errors path="name" />
    </td>
  </tr>
   <tr>
    <td width="400" height="35">
       <label for="webSite">企业网站 ： </label>
        <form:input path="webSite" size="30"/>
        <form:errors path="webSite" />
    </td>
  </tr>
   <tr>
    <td width="400" height="35">
       <label for="email">电子邮件 ： </label>
       <form:input path="email" size="30" />
       <form:errors path="email" />
    </td>
  </tr>
   <tr>
    <td width="400" height="35">
       <label for="fax">电话号码 ： </label>
       <form:input path="phone" size="30" cssClass="require"/>
       <form:errors path="phone" />
    </td>
  </tr>
   <tr>
    <td width="400" height="35">
       <label for="fax">传真号码 ： </label>
       <form:input path="fax" size="30"/>
       <form:errors path="fax" />
    </td>
  </tr>
   <tr>
    <td width="400" height="21">（地址栏生成，<a href="#" onClick="onMap()">请点击这里)</a></td>
  </tr>
   <tr>
    <td width="400" height="35">
       <label for="address">公司地址 ： </label>
       <form:input path="address" size="30" cssClass="require"/>
       <form:errors path="address" />
    </td>
  </tr>
   <tr>
    <td width="400" height="35">
       <label for="longitude">经纬度定位 ： </label>
       <form:input path="longitude" size="10" cssClass="require"/>
       <form:errors path="longitude" />&nbsp;
       <form:input path="latitude" size="10" cssClass="require"/>
       <form:errors path="latitude" />
    </td>
  </tr>
 
    <tr>
    <td height="80">
      <label for="image">形象图片 ： </label>
      <input type="file" name="file" id="image" onchange='loadImage(this)'/>
        
         <c:if test="${companyTouch.id>0}">
            <img src="<%=basePath %>image/CompanyTouch/Img.do?id=${companyTouch.id}&index=1" width="80" height="80" />
         </c:if>
         
       <div id="preview_fake" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)">
        <img id="preview" onload="onPreviewLoad(this)" />
      </div>
      
    </td>
  </tr>
  <tr> 
     <td> <form:errors path="image" /> </td> 
  </tr>
  
  <tr>
    <td height="27">（图片大小不宜超过1024KB,支持格式为 jpg , png ）</td>
  </tr>
  <tr>
    <td>
      <input type="button" value="提   交" id="formbutton" onclick="edit(this)"/>
      &nbsp;&nbsp;&nbsp;
      <input type="button" value="取  消" id="formbutton" onclick="cancel()"/>
    </td>
  </tr>
</table>
</form:form>



<script type="text/javascript" src="<%=basePath %>js/imagePreview.js"></script>
<script type="text/javascript" src="<%=basePath %>js/formValidate.js"></script>
<script type="text/javascript">

 function edit(bt){
 
   var form=document.getElementById('myForm');
 
   if(confirm('你确定要提交吗？')){
      
       if(emptyValidate(form)){
    
           form.submit();
       }
    }
 }


 function cancel(){
 
    location.href="companyInt.do";
 }


 function validate(form){
  
     if(!emptyValidate(form)){
      
          return false;
      }
      
      return true;
  }
  
</script>

  </body>
</html>
